package sorting;

import util.Tracer;

public class MinimumAndMaximum {
	public static float[] minimumAndMaximum(float[] numbers)
	{
		float min = Float.POSITIVE_INFINITY, max = Float.NEGATIVE_INFINITY;
		for(int i = 0; i < numbers.length; i += 2)
		{
			min = Math.min(min, Math.min(numbers[i], numbers[i + 1]));
			max = Math.max(min, Math.max(numbers[i], numbers[i + 1]));
		}
		
		return new float[]{min, max};
	}
	
	public static void main(String[] args) {
		Tracer.trace(minimumAndMaximum(new float[]{1, 2, 3, 4, 4,5,5,5,5,110}));
	}
}
